package org.belkodevelop.realty.service;

import org.belkodevelop.realty.dao.RealtyDAO;
import org.belkodevelop.realty.domen.Realty;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class RealtyService {
    @Autowired
    private RealtyDAO realtyDAO;
    
    @Transactional
    public void addRealty(Realty realty) {
        realtyDAO.addRealty(realty);
    }

    @Transactional
    public void removeRealty(long id){
        realtyDAO.removeRealty(id);
    }

    @Transactional(readOnly = true)
    public Realty getRealtyById(long id) {
        return realtyDAO.getRealtyById(id);
    }
}
